<template>
  <div class="app-container">
    <div class="filter-container default-box">
      <span>用户ID：</span>
      <el-input v-model="listQuery.title" placeholder="请输入用户ID" style="width: 240px;" class="filter-item" />
      <span style="padding-left: 100px;">订单号：</span>
      <el-input v-model="listQuery.title" placeholder="请输入订单号" style="width: 240px;" class="filter-item" />
      <span style="padding-left: 100px;">磐河订单号：</span>
      <el-input v-model="listQuery.title" placeholder="请输入磐河订单号：" style="width: 240px;" class="filter-item" />
      <span style="padding-left: 100px;">状态：</span>
      <el-select v-model="statusvalue" filterable placeholder="请选择">
        <el-option v-for="item in statusoptions" :key="item.value" :label="item.label" :value="item.value" />
      </el-select>
      <el-button class="filter-item" type="primary" icon="el-icon-search" style="margin-left:50px" round>
        查询
      </el-button>
      <el-button class="filter-item" icon="el-icon-refresh-right" round>
        重置
      </el-button>
    </div>
    <div class="default-box">
      <el-table
        :key="tableKey"
        v-loading="listLoading"
        :data="list"
        fit
        highlight-current-row
        style="width: 100%;"
      >
        <el-table-column label="订单编号" sortable width="250" show-overflow-tooltip>
          <template>
            <span>2023030664055221934c47260tn1</span>
          </template>
        </el-table-column>
        <el-table-column label="磐河订单编号" sortable width="250" show-overflow-tooltip>
          <template>
            <span>T23030415350451628</span>
          </template>
        </el-table-column>
        <el-table-column label="用户ID" width="250" show-overflow-tooltip>
          <template>
            <span>637963718264754200</span>
          </template>
        </el-table-column>
        <el-table-column label="出行人/手机号" width="250">
          <template>
            <span>胡歌: 15825323232</span>
          </template>
        </el-table-column>
        <el-table-column label="门票产品信息" width="500" show-overflow-tooltip>
          <template>
            <span>季高乐园·JEGOLAND家庭娱乐中心-JEGOLAND乐园畅玩年卡亲子票1大1小</span>
          </template>
        </el-table-column>
        <el-table-column label="订单金额（积分）" width="250">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="下单时间/出票时间" width="350" show-overflow-tooltip>
          <template>
            <span>2023-02-27 17:12:40/2023-02-27 17:18:45</span>
          </template>
        </el-table-column>
        <el-table-column label="状态" width="250">
          <template>
            <span>
              已取消
            </span>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="250" class-name="small-padding fixed-width">
          <template>
            <el-button type="danger">返回积分</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
  </div>
</template>

<script>
import { fetchList } from '@/api/article'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default {
  name: 'Adminrole',
  components: { Pagination },
  data() {
    return {
      tableKey: 0,
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 10,
        importance: undefined,
        title: undefined,
        type: undefined,
        sort: '+id'
      },
      statusoptions: [{ // 状态选择项组
        value: '',
        label: '全部'
      }, {
        value: '占位中',
        label: '占位中'
      }, {
        value: '占位成功',
        label: '占位成功'
      }, {
        value: '占位失败',
        label: '占位失败'
      }, {
        value: '已取消',
        label: '已取消'
      }],
      statusvalue: ''// 状态的类型
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList(this.listQuery).then(response => {
        this.list = response.data.items
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    }
  }
}
</script>
<style scoped>
  [class^=el-icon-], [class*=" el-icon-"]{
    font-size: 16px;
  }
  .small-padding i{
    margin-right: 12px;
  }
  .small-padding i:last-child{
    margin-right: 0px;
  }
  ::v-deep .filter-container .el-input--medium .el-input__inner{
    width: 240px;
  }
</style>
